import Vue from 'vue';
import Vuex from 'vuex';
import createPersistedState from 'vuex-persistedstate';

Vue.use(Vuex);

// state原始数据
const _initState = {};

const cloneDeep = (data) => JSON.parse(JSON.stringify(data));

const store = new Vuex.Store({
  state: cloneDeep(_initState),
  getters: {},
  mutations: {},
  actions: {},
  modules: {},
  plugins: [
    createPersistedState({
      storage: window.localStorage,
      key: 'lego-pc-vue-cli'
    })
  ]
});

export default store;
